package com.bonc.modules.fileManage.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonc.datasource.annotation.DataSource;
import com.bonc.factory.PageFactory;
import com.bonc.modules.fileManage.Dao.FileDao;
import com.bonc.modules.fileManage.service.FileService;
import com.bonc.modules.target.entity.UpgTsServExtendEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("fileService")
@DataSource("data")
public class FileServiceImpl implements FileService {

    @Autowired
    private FileDao fileDao;

    @Override
    public boolean queryFileByFileName(Map<String, String> paramMap) {
        boolean b = false;
        List<Map<String,Object>> list =  this.fileDao.queryFileByFileName(paramMap);
        if(list .size()!=0){
            b =true;
        }
        return b;
    }

    @Override
    public Integer deleteFileData(Map<String, String> paramMap) {
       Integer i =  this.fileDao.deleteFileData(paramMap);
       return i;
    }

    @Override
    public void importFileData(Map<String, String> paramMap) {
        Integer i =  this.fileDao.importFileData(paramMap);
    }

    @Override
    public Page queryFileManagePage(Map<String, Object> params) {
        Page<List<Map<String,Object>>> page = this.fileDao.queryFilePage(PageFactory.defaultPage(), params);
        return  page;
    }

    @Override
    public List<Map<String, Object>> queryFileType() {
        return this.fileDao.queryFileType();
    }

    @Override
    public Map<String, String> getFileManageType(String fileTypeNum) {
        return this.fileDao.getFileManageType(fileTypeNum);
    }

    @Override
    public void delFile(Map<String, String> paramMap) {
        this.fileDao.delFile(paramMap);
    }
}
